//
//  DXBaseController.m
//  mediaplatform
//
//  Created by dd on 7/23/14.
//  Copyright (c) 2014 intwin. All rights reserved.
//

#import "DXBaseController.h"
#import "DXUtil.h"
#import "DXButton.h"


@interface DXBaseController ()

@end

@implementation DXBaseController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)loadView
{
    [super loadView];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.extendedLayoutIncludesOpaqueBars = YES;

    self.view.backgroundColor = [UIColor clearColor];
    
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}





- (void)clickBackBtnHanlder:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
    [self.navigationController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
    [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}

- (UIView *)makeLine:(float)y
{
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, y, 320, 0.5)];
    line.backgroundColor = [DX colorWithHex:@"dadada"];
    return line;
}

- (UIView *)makeGroup:(int)numberOfInput y:(float)y
{
    UIView *holder = [[UIView alloc] initWithFrame:CGRectMake(0, y, 320, numberOfInput * 44)];
    holder.backgroundColor = [UIColor whiteColor];
    for (int i = 0; i <= numberOfInput; i++)
    {
        UIView *line = [self makeLine:i * 44];
        [holder addSubview:line];
    }
    
    return holder;
}

- (DXButton *)makeBtn:(NSString *)title frame:(CGRect)frame
{
    DXButton *btn = [[DXButton alloc] initWithFrame:frame];
    [btn setTitle:title textColor:[UIColor blackColor] shadowColor:nil fontSize:16 bold:NO];
    
    
    return btn;
}

- (DXButton *)makeGreenBtn:(NSString *)title y:(float)y
{
    DXButton *btn = [[DXButton alloc] initWithFrame:CGRectMake(15, y, 290, 35)];
    [btn addTarget:self action:@selector(touchDownGreenBtnHandler:) forControlEvents:UIControlEventTouchDown];
    [btn addTarget:self action:@selector(touchUpGreenBtnHandler:) forControlEvents:UIControlEventTouchUpInside];
    [btn addTarget:self action:@selector(touchUpGreenBtnHandler:) forControlEvents:UIControlEventTouchUpOutside];
    btn.backgroundColor = [DX colorWithHex:@"1c890d"];
    
    [btn setTitle:title textColor:[UIColor whiteColor] shadowColor:nil fontSize:16 bold:NO];
    
    return btn;
}

- (void)touchDownGreenBtnHandler:(id)sender
{
    UIButton *btn = sender;
    btn.backgroundColor = [DX colorWithHex:@"0f6d00"];
    [DX i:@"touch down btn"];
}

- (void)touchUpGreenBtnHandler:(id)sender
{
    UIButton *btn = sender;
    btn.backgroundColor = [DX colorWithHex:@"1c890d"];
}

- (void)shouldLogout
{

}

@end
